package com.fun.demo.annotation;

import java.util.Random;

public class LuckTicket {
    public static String publicTicket(){
        Random rd = new Random();
        StringBuffer sb = new StringBuffer();
        int a  = rd.nextInt(100);
        int b  = rd.nextInt(100);
        int c  = rd.nextInt(100);
        int d  = rd.nextInt(100);
        int e  = rd.nextInt(100);
        int f  = rd.nextInt(100);
        //int g  = rd.nextInt(100);
        sb.append(a + "-").append(b + "-").append(c + "-").append(d + "-").append(e + "-").append(f);//.append(g);
        return sb.toString();
    }


    //int num = Math.random();
    public static void main(String[] args) {
        String publicNum = LuckTicket.publicTicket();
       System.out.println("公布号码：" + publicNum);
        int i = 1;
        while(true){
            String buyNum = LuckTicket.publicTicket();
            if(buyNum.equals(publicNum)){
                System.out.println("我的号码：" + buyNum);
                System.out.println("OK! ");
                System.out.println("次数：" + i);
                return;
            }
            i++;
        }

    }


}
